<div class="container">
    <div class="row">
        <div class="span12">
            <div class="widget">
            	<form id="myForm" action="${base}/show_resource/show_resource_ip" method="post">
            	集群名称：<input type="text" id="cluster" name="cluster" value="${cluster!}" />&nbsp;&nbsp;
            	ip：<input type="text" id="ip" name="ip" value="${ip!}" />&nbsp;&nbsp;<a href="javascript:void(0)" onclick="doSubmit()">查看</a>
            	</form>
                <table border="1" style="table-layout:fixed;" width="1024">
                	<tr>
                		<th>集群</th>
                		<th>ip地址</th>
                		<th width="160">属性</th>
                		<th>属性值</th>
                		<th>原属性值</th>
                		<th>创建时间</th>
                		<th>更新时间</th>
                		<th width="50">操作</th>
                	</tr>
                <#list resourceManageList as rm>
                	<tr>
                		<td>${rm.cluster}</td>
                		<td>${rm.ip}</td>
                		<td>${rm.attribute}</td>
                		<td><input id="attributeValue${rm.id}" type="text" value="${rm.attributeValue!}" style="width:100px"/></td>
                		<td style="word-wrap:break-word;" width="20">${rm.attributeOldValue!}</td>
                		<td><#if rm.createTime?exists>${rm.createTime?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
                		<td><#if rm.updateTime?exists>${rm.updateTime?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
                		<td><a href="javascript:void(0)" onclick="invoke(${rm.id})">推送</a></td>
                	</tr>
				</#list> 
				</table>
            </div>
        </div>
    </div>
</div>
<script src="${base}/resources/javascripts/jquery.min.js"></script>
<script type="text/javascript">
	<!--
	function doSubmit() {
		$("#myForm").submit();
	}
	
	function invoke(id) {
		var attrValue = $("#attributeValue" + id).val();
		if(confirm("确定要推送数据吗")){
			$.ajax({
	            type: "POST",
	            url: "${base}/resource_manage/push_attribute",
	            data: {"resourceId":id,"attributeValue":attrValue},       
	            dataType: "json", 
	            success: function (result) {
	            	if(result.code == 0) {
	            		alert("推送成功");
	            	} else {
	            		alert("推送失败");
	            	}
	            },

	            error: function (result) { 
	               alert("错误");
	            } 
    		});
		}
	}
	//-->
</script>
